{{ extend '../_layouts/home.html' }}

{{ block 'title' }}{{ '多人博客 - 编辑话题' }}{{ /block }}

{{ block 'body' }} 
<section class="container">
    <div class="col-md-9 bgColor">
        <ul class="breadcrumb">
            <li><a href="/">主页</a></li>
            <li class="active">编辑话题</li>
        </ul>
        <form action="/topic/edit" method="post" id="post_topic">
            <div class="form-group">
                <input type="hidden" name="id" value="{{ formateId(topic._id) }}">
                <input type="hidden" name="uId" value="{{ user._id }}">
                <p class="myType" style="display: none;">{{ topic.type }}</p>
                <label for="exampleInputPassword1">选择板块</label>
                <select class="form-control" name="type" id="typeMe">
                    <option value="">请选择</option>
                    <option value="分享">分享</option>
                    <option value="问答">问答</option>
                    <option value="招聘">招聘</option>
                    <option value="测试">测试</option>
                </select>
            </div>
            <div class="form-group">
                <label for="title">标题</label>
                <input type="text" class="form-control" id="title" placeholder="请输入标题" name="title" value="{{ topic.title }}">
            </div>
            <div class="form-group">
                <div id="editor">
                    <textarea id="editorMe" style="display:none;" name="content" value="{{ topic.content }}">{{ topic.content }}</textarea>
                </div>
            </div>
            <button type="submit" class="btn btn-success">提交</button>
        </form>
    </div>
    <div class="col-md-3">
        <div class="bg2Color">
            <ul class="breadcrumb">
                <li class="active">Markdown 语法参考</li>
            </ul>
            <a href="https://segmentfault.com/markdown">Markdown 文档</a>
        </div>
    </div>
</section>
{{ /block }}
{{ block 'script' }}
<script type="text/javascript">
    $(function() {
        var editor = editormd("editor", {
            width: "100%",
            height: "500px",
            path : "/node_modules/editor.md/lib/",
            watch: false,
            placeholder: "请输入您想说的吧！",
            emoji: true
        })
        var myType = $('.myType').text()
        $("#typeMe").find("option[value='"+ myType +"']").attr("selected",true);
    })
</script>
{{ /block }}